home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: miker3@ix.netcom.com (Mike Rubenstein)
- Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.lang.eiffel
- Subject: Re: Hungarian notation
- Date: Tue, 23 Jan 1996 11:03:03 GMT
- Organization: Netcom
- Message-ID: <3104bfc8.132251392@nntp.ix.netcom.com>
- References: <30C40F77.53B5@swsbbs.com> <4d2ok0$69s@beach.and.nl> <4dtv3gINNo9u@keats.ugrad.cs.ubc.ca> <SPENCER.96Jan22113215@zorgon.ERA.COM> <4e1nd8$hv0@solutions.solon.com>
- NNTP-Posting-Host: ix-dc6-08.ix.netcom.com
- X-NETCOM-Date: Tue Jan 23 3:02:33 AM PST 1996
- X-Newsreader: Forte Agent .99c/16.141
-
- seebs@solutions.solon.com (Peter Seebach) wrote:
-
- > In article <SPENCER.96Jan22113215@zorgon.ERA.COM>,
- > Spencer Allain <spencer@ERA.COM> wrote:
- > >It is incorrect to say that a 'char' (of size 1 byte on many systems)
- > >and an 'int' (of size 4 bytes on many systems) is structurally
- > >equivalent, yet I must be able to compile this without errors:
- > >(warnings are _not_ errors -- though I get none compiling this anyway)
- >
- > > char a;
- > > int b;
- >
- > > int main()
- > > {
- > > b = -154267 ;
- > > a = b ;
- > > return 0 ;
- > > }
- >
- > No warnings, perhaps, but undefined behavior unless CHAR_MIN is
- > less than or equal to -154267.
- >
- > And yes, we know C intentionally gives up some type safety for being
- > easy to compile.
- >
- > :)
-
- That does not result in undefined behavior. From ISO 6.2.1.2:
-
- When a value with integral type is demoted to a signed integer
-
- with smaller size or an unsigned integer is converted to its
- corresponding signed integer, if the value cannot be
- represented the result is implementation defined.
-
- An implementation must handle this and must document how it does so.
-
-
- Michael M Rubenstein
-